class Person{
    protected username:string;
    age:number;
    constructor(name:string,age:number){
        this.username = name;
        this.age = age;
    }

    say(){
        console.log('类内部',this.username)
    }
}

class Student extends Person{
    constructor(name:string,age:number){
        super(name,age)
    }

    learn(){
        console.log('子类---',this.username)
    }
}

let p1 = new Person('lili',18);

// console.log("===",p1.username)

p1.say();


let s1 = new Student('zs',10);
s1.learn();



//修饰符

//公共  public  在类内核子类和实例都可以访问

//受保护 protected  只能在类内核子类使用，在实例无法访问

//私有  private 只能在类内访问，在子类和实例上都不可以访问





